local kuiduo = fk.CreateSkill{
  name = "lingling__kuiduo",
}

Fk:loadTranslationTable{
  ["lingling__kuiduo"] = "揆度",
  [":lingling__kuiduo"] = "出牌阶段限一次，你可以移除〖威福〗的一句描述，然后从弃牌堆获得两张牌。",

  ["#lingling__kuiduo"] = "揆度：你可以移除〖威福〗的一句描述，然后从弃牌堆获得两张牌",
  ["#lingling__kuiduo-prey"] = "揆度：从弃牌堆获得两张牌",
}

kuiduo:addEffect("active", {
  anim_type = "drawcard",
  card_num = 0,
  target_num = 0,
  prompt = "#lingling__kuiduo",
  interaction = function(self, player)
    local choices = table.map(player:getTableMark("lingling__weifu"), function (n)
      return "lingling__weifu"..n
    end)
    return UI.ComboBox { choices = choices }
  end,
  can_use = function(self, player)
    return player:usedSkillTimes(kuiduo.name, Player.HistoryPhase) == 0 and
      #player:getTableMark("lingling__weifu") > 0
  end,
  card_filter = Util.FalseFunc,
  on_use = function(self, room, effect)
    local player = effect.from
    room:removeTableMark(player, "lingling__weifu", tonumber(self.interaction.data[16]))
    if #room.discard_pile > 0 then
      local cards = room:askToChooseCards(player, {
        target = player,
        min = 2,
        max = 2,
        flag = { card_data = {{ "pile_discard", room.discard_pile }} },
        skill_name = kuiduo.name,
        prompt = "#lingling__kuiduo-prey",
      })
      room:moveCardTo(cards, Card.PlayerHand, player, fk.ReasonJustMove, kuiduo.name, nil, true, player)
    end
  end,
})

return kuiduo
